//    Openbravo POS is a point of sales application designed for touch screens.
//    Copyright (C) 2008-2009 Openbravo, S.L.
//    http://www.openbravo.com/product/pos
//
//    This file is part of Openbravo POS.
//
//    Openbravo POS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Openbravo POS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Openbravo POS.  If not, see <http://www.gnu.org/licenses/>.
package com.openbravo.pos.sales.restaurant;

import cn.ekuma.epos.datalogic.I_DataLogicCustomers;
import cn.ekuma.epos.datalogic.I_DataLogicSales;
import com.openbravo.bean.Place;

import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;

/**
 * @author adrian
 */
public class JSimplePlaceGroup extends javax.swing.JPanel {

    protected I_DataLogicCustomers dlCustomers;
    protected I_DataLogicSales dlSales;
    private JPlaceList jplaces;

    /**
     * Creates new form JSimplePlaceGroup
     */
    public JSimplePlaceGroup() {
        initComponents();

        // dlSystem.getResourceAsXML("Ticket.Line")
        jplaces = new JPlaceList();
        jPanel2.add(jplaces, BorderLayout.CENTER);
    }

    public void refush(List<Place> iplaces) {
        jplaces.reflush(iplaces);
    }

    public List<Place> getPlaces() {
        return jplaces.getAll();
    }

    public Place[] getSelectedLines() {
        return jplaces.getSelectedObjects();
    }

    public void removeLines(Place[] lines) {
        jplaces.removeLines(lines);
    }

    public void addSelectedLines(Place[] lines) {
        // add all at the end in inverse order.
        jplaces.addSelectedLines(lines);
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();

        setLayout(new java.awt.BorderLayout());

        jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
        jPanel1.setLayout(new java.awt.BorderLayout());
        add(jPanel1, java.awt.BorderLayout.SOUTH);

        jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
        jPanel2.setLayout(new java.awt.BorderLayout());
        add(jPanel2, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables

    void selectUpIndex() {
        jplaces.selectionUp();
    }

    void selectDownIndex() {
        jplaces.selectionDown();
    }
}
